<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>密码框验证(仿新浪注册)</title>
</head>
<body>
    <input type="password" value="" class="pwd">
    <p class="msg">请输入6~16位密码</p>
    <script>
        var pwd = document.querySelector('.pwd');
        var msg = document.querySelector('.msg');

        pwd.onblur = function() {
            if (this.value.length < 6 || this.value.length > 16) {

            }    
        }
    </script>
</body>
</html>